<style type="text/css">
	#cafe-info {
		font-size:10pt;
		border:1px solid #ebebeb;
		padding:15px 15px;
		margin-left:15px;
	}
	#cafe-info h2{
		font-size:12pt;
		padding:0px;
		margin:0px;
	}
	.btn-menu{
		width:55px;
		text-align:center;
	}
</style>
<div class="row widget">
	<div id="cafe-info">
		<div class="text-center">
			<img class="logo" src="<?php print $data['CAF_IMG_L_FILENAME']; ?>" style="width:150px; height:150px; margin-bottom:20px;" />
			<div class="btn-group text-center">
				<?php if ($favorited): ?>
					<button class="btn btn-mini btn-menu active" id="btn-add-cafe-favorite"><i class="icon-star"></i><br />ร้านโปรด</button>
				<?php else: ?>
					<button class="btn btn-mini btn-menu" id="btn-add-cafe-favorite"><i class="icon-star"></i><br />ร้านโปรด</button>
				<?php endif; ?>
				<button class="btn btn-mini btn-menu"><i class="icon-signal"></i><br />โหวต</button>
				<button class="btn btn-mini btn-menu"><i class="icon-signal"></i><br />โหวต</button>
			</div>
		</div>		
		<dl>
			<dt><h2>ข้อมูลทั่วไป</h2></dt>
			<dd>
				<ul class="unstyled">
					<li><b class="block">ชื่อร้าน:</b> <?php print $data['CAF_TITLE']; ?></li>
					
					<?php if (!empty($data['CAF_WEBSITE'])): ?>					
					<li><b class="block">เว็บไซต์:</b> <a href="<?php print $data['CAF_WEBSITE']; ?>" target="_blank"><?php print $data['CAF_WEBSITE']; ?></a></li>
					<?php endif; ?>
					
					<?php if (!empty($data['CAF_FACEBOOK'])): ?>
					<li><b class="block">Facebook:</b> <a href="<?php print $data['CAF_FACEBOOK']; ?>" target="_blank"><?php print $data['CAF_FACEBOOK']; ?></a></li>
					<?php endif; ?>
					
					<?php if (count($types) > 0): ?>
					<li><b class="block">บริการอื่นๆ:</b> 
						<?php if (count($types) > 0): ?>
							<ul class="nav-stacked">
							<?php for ($i=0; $i<count($types); $i++): ?>
								<li><?php print $types[$i]; ?></li>
							<?php endfor; ?>						
								
							</ul>															
						<?php endif; ?>
					</li>
					<?php endif; ?>
				</ul>
			</dd>
			<dt><h2>ข้อมูลทางสถิติ</h2></dt>
			<dd>
				<ul class="unstyled">
					<li><b>ระดับคะแนน: </b>4.53</li>
					<li><b>อันดับ: </b>#53</li>
					<li><b>จำนวนผู้ติดตาม: </b><?php print $favorite_count; ?></li>
				</ul>
			</dd>
		</dl>
	</div>
</div>
<script type="text/javascript">
	$(function(){
		$('#btn-add-cafe-favorite').click(function(){
			var me = $(this);
			if ($(this).hasClass('active')){
				$.post('<?php print base_url() . $cafe_name . '/ajax_remove_favorite_cafe'; ?>', function(output){
					if (output.result !== '-1')
						me.removeClass('active');					
					alert(output.message);				
				},'json');				
			} else {
				$.post('<?php print base_url() . $cafe_name . '/ajax_add_favorite_cafe'; ?>', function(output){
					if (output.result !== '-1')
						me.addClass('active');										
					alert(output.message);
				},'json');				
			}
		});
	});
</script>